]>
Commit | Line | Data |
---|---|---|
74c15570 BB |
1 | using System; |
2 | using System.Collections.Generic; | |
3 | using System.Linq; | |
4 | using System.Text; | |
5 | using Microsoft.Xna.Framework; | |
6 | using Microsoft.Xna.Framework.Graphics; | |
7 | using Microsoft.Xna.Framework.Input; | |
8 | ||
9 | namespace SuperPolarity | |
10 | { | |
11 | class GameScreen : Screen | |
12 | { | |
13 | public GameScreen(SuperPolarity newGame) : base(newGame) {} | |
14 | ||
15 | public override void Initialize() | |
16 | { | |
17 | InputController.RegisterEventForButton("changePolarity", Buttons.A); | |
18 | InputController.RegisterEventForKey("changePolarity", Keys.Z); | |
19 | ||
20 | InputController.RegisterEventForButton("shoot", Buttons.X); | |
21 | InputController.RegisterEventForKey("shoot", Keys.X); | |
22 | } | |
23 | ||
24 | public override void LoadContent() | |
25 | { | |
26 | Vector2 playerPosition = new Vector2(Game.GraphicsDevice.Viewport.TitleSafeArea.X, Game.GraphicsDevice.Viewport.TitleSafeArea.Y + Game.GraphicsDevice.Viewport.TitleSafeArea.Height / 2); | |
27 | ||
28 | Renderer.CheckIn(ActorFactory.CreateMainShip(playerPosition)); | |
29 | Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Positive, new Vector2(200, 200))); | |
30 | Renderer.CheckIn(ActorFactory.CreateShip(Ship.Polarity.Negative, new Vector2(400, 200))); | |
31 | } | |
32 | ||
33 | public override void Update(GameTime gameTime) | |
34 | { | |
35 | InputController.UpdateInput(); | |
36 | ActorManager.Update(gameTime); | |
37 | } | |
38 | ||
39 | public override void Draw(SpriteBatch spriteBatch) | |
40 | { | |
41 | Renderer.Draw(spriteBatch); | |
42 | } | |
43 | } | |
44 | } |